﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using System.Collections;

namespace Medianamik.Core.ImportExport
{
    public class JSonNodeDataSourceSerializer : NodeDataSourceSerializer 
    {
        public override void Serialize(NodeDataSourceData data, System.IO.TextWriter writer)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            serializer.MaxJsonLength = int.MaxValue;
            writer.Write(serializer.Serialize(data));
        }

        public override NodeDataSourceData Deserialize(string jSon)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            serializer.MaxJsonLength = int.MaxValue;
            return serializer.Deserialize<NodeDataSourceData>(jSon); 
        }
    }
}
